home *** CD-ROM | disk | FTP | other *** search
/ .net 2002 March / DotNetMagazine-Issue107-Coverdisc-NET107-02-03-PCMac.bin / pc / PC Software / free_browsing / DavesQckSearchDbar3-14 / dqsd.exe / src / DQSDTools / Launcher.h < prev    next >
C/C++ Source or Header  |  2002-07-24  |  3KB  |  106 lines

  1. //
  2. // DQSDTools ActiveX server for Dave's Quick Search Deskbar
  3. //  Copyright (c) 2001 Koen Mannaerts
  4. //  Distributed under the terms of the 
  5. //  GNU Public License, Version 2
  6. //  http://www.WhirlyWiryWeb.com
  7. //
  8. // Dave's Quick Search Deskbar
  9. //    Copyright (c) 2001 David Bau, 
  10. //  Distributed under the terms of the 
  11. //  GNU Public License, Version 2
  12. //  http://notesbydave.com/toolbar/searchdoc.htm
  13. //
  14.  
  15. // Launcher.h : Declaration of the CLauncher
  16.  
  17. #ifndef __LAUNCHER_H_A43187EC_B518_40a5_9615_C628D10567E4__
  18. #define __LAUNCHER_H_A43187EC_B518_40a5_9615_C628D10567E4__
  19.  
  20. #include "resource.h"       // main symbols
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CLauncher
  24. class ATL_NO_VTABLE CLauncher : 
  25.     public CComObjectRootEx<CComSingleThreadModel>,
  26.     public CComCoClass<CLauncher, &CLSID_Launcher>,
  27.     public IDispatchImpl<ILauncher, &IID_ILauncher, &LIBID_DQSDTOOLSLib>,
  28.     public IObjectWithSiteImpl<CLauncher>,
  29.     public IObjectSafetyImpl<CLauncher, INTERFACESAFE_FOR_UNTRUSTED_CALLER>,
  30.     public ISupportErrorInfoImpl< &IID_ILauncher >
  31. {
  32. public:
  33.     CLauncher()
  34.     : m_bDebug(false)
  35.     {
  36.         ATLTRACE("CLauncher - created\n");
  37. //        m_hBaseTooltipWnd = NULL;
  38.         m_hHotkeyNotificationWindow = NULL;
  39.         m_hKeyboardHook = NULL;
  40.     }
  41.  
  42.     virtual ~CLauncher()
  43.     {
  44.         ATLTRACE("CLauncher - destroyed\n");
  45.         ATLTRACE("DQSDTools: Lock count %d\n", _Module.GetLockCount());
  46.  
  47.         if(m_hHotkeyNotificationWindow != NULL)
  48.         {
  49.             DestroyWindow(m_hHotkeyNotificationWindow);
  50.         }
  51.  
  52.         KeyboardHookRemove(m_hKeyboardHook);
  53.     }
  54.  
  55. DECLARE_REGISTRY_RESOURCEID(IDR_LAUNCHER)
  56.  
  57. DECLARE_PROTECT_FINAL_CONSTRUCT()
  58.  
  59. BEGIN_COM_MAP(CLauncher)
  60.     COM_INTERFACE_ENTRY(ILauncher)
  61.     COM_INTERFACE_ENTRY(IDispatch)
  62.     COM_INTERFACE_ENTRY(IObjectWithSite)
  63.     COM_INTERFACE_ENTRY(IObjectSafety)
  64.     COM_INTERFACE_ENTRY(ISupportErrorInfo)
  65. END_COM_MAP()
  66.  
  67. // ILauncher
  68. public:
  69.     STDMETHOD(get_pathDefaultBrowser)(/*[out, retval]*/ BSTR *pVal);
  70.     STDMETHOD(OpenDocument)(/*[in]*/ BSTR strDoc, VARIANT* pvParameters);
  71.     STDMETHOD(SubmitForm)(/*[in]*/ VARIANT idForm);
  72.     STDMETHOD(get_Debug)(/*[out,retval]*/ VARIANT_BOOL* pbDebug );
  73.     STDMETHOD(put_Debug)(/*[in]*/ VARIANT_BOOL bDebug );
  74.     STDMETHOD(ReadFile)(/*[in]*/ BSTR bstrFilename, /*[out,retval]*/ BSTR* pbstrResult);
  75.     STDMETHOD(WriteFile)(/*[in]*/ BSTR bstrFilename, /*[in]*/ BSTR bstrValue);
  76.     STDMETHOD(GetProtocolHandler)(/*[in]*/ BSTR bstrProtocol, /*[out,retval]*/ BSTR* pbstrHandler);
  77.     STDMETHOD(GetFiles)(/*[in]*/ BSTR bstrFileSpec, /*[out,retval]*/ BSTR* pbstrFiles);
  78.  
  79. public:
  80.     STDMETHOD(RegisterHotKey)(long hotkeyVkCode, BSTR bstrModifierName, LPDISPATCH pDispDocument);
  81.     STDMETHOD(InstallKeyboardHook)(LPDISPATCH pDispDocument);
  82.     STDMETHOD(MapKeyCode)(long lVKCode, long lCharCode);
  83.  
  84. public:
  85.     STDMETHOD(RefreshTrayIcons)();
  86.     STDMETHOD(ShutdownBar)(LPDISPATCH pDispDocument );
  87.     STDMETHOD(get_VersionIsCorrect)(int v1, int v2, int v3, int v4, /*[out, retval]*/ VARIANT_BOOL *pVal);
  88.     STDMETHOD(SetSite)(IUnknown* pUnkSite);
  89.  
  90. // Implementation
  91. private:
  92.     static LPCTSTR DQSD_REG_KEY;
  93.     static LPCTSTR DQSD_SEC_KEY;
  94.     bool    m_bDebug;
  95.     HHOOK    m_hKeyboardHook;
  96.  
  97. //    HWND    m_hBaseTooltipWnd;
  98.     HWND    m_hHotkeyNotificationWindow;
  99.  
  100. private:
  101.     HRESULT GetFilename( LPCTSTR szName, LPTSTR szResult, LPCTSTR pszDefaultExt = _T(".txt") );
  102.  
  103. };
  104.  
  105. #endif // __LAUNCHER_H_A43187EC_B518_40a5_9615_C628D10567E4__
  106.